using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._SegmentationandClassification
{
    /// <summary>
    /// <para>Train ISO Cluster Classifier</para>
    /// <para>Generates an Esri classifier definition file (.ecd) using the Iso Cluster classification definition.</para>
    /// <para>使用 Iso 聚类分类定义生成 Esri 分类器定义文件 （.ecd）。</para>
    /// </summary>    
    [DisplayName("Train ISO Cluster Classifier")]
    public class TrainIsoClusterClassifier : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TrainIsoClusterClassifier()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para>The raster dataset to classify.</para>
        /// <para>要分类的栅格数据集。</para>
        /// </param>
        /// <param name="_max_classes">
        /// <para>Max Number Of Classes / Clusters</para>
        /// <para><xdoc>
        ///   <para>Maximum number of desired classes to group pixels or segments. This should be set to be greater than the number of classes in your legend.</para>
        ///   <para>It is possible that you will get fewer classes than what you specified for this parameter. If you need more, increase this value and aggregate classes after the training process is complete.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要对像素或线段进行分组的所需类的最大数量。此值应设置为大于图例中的类数。</para>
        ///   <para>您得到的类可能会少于为此参数指定的类。如果需要更多，请在训练过程完成后增加此值并聚合类。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_classifier_definition">
        /// <para>Output Classifier Definition File</para>
        /// <para>The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.</para>
        /// <para>输出 JSON 格式文件，其中包含分类器的属性信息、统计信息、超平面向量和其他信息。将创建一个 .ecd 文件。</para>
        /// </param>
        public TrainIsoClusterClassifier(object _in_raster, long? _max_classes, object _out_classifier_definition)
        {
            this._in_raster = _in_raster;
            this._max_classes = _max_classes;
            this._out_classifier_definition = _out_classifier_definition;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Train ISO Cluster Classifier";

        public override string CallName => "sa.TrainIsoClusterClassifier";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "parallelProcessingFactor", "scratchWorkspace", "snapRaster", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _max_classes, _out_classifier_definition, _in_additional_raster, _max_iterations, _min_samples_per_cluster, _skip_factor, _used_attributes, _max_merge_per_iter, _max_merge_distance];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The raster dataset to classify.</para>
        /// <para>要分类的栅格数据集。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Max Number Of Classes / Clusters</para>
        /// <para><xdoc>
        ///   <para>Maximum number of desired classes to group pixels or segments. This should be set to be greater than the number of classes in your legend.</para>
        ///   <para>It is possible that you will get fewer classes than what you specified for this parameter. If you need more, increase this value and aggregate classes after the training process is complete.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要对像素或线段进行分组的所需类的最大数量。此值应设置为大于图例中的类数。</para>
        ///   <para>您得到的类可能会少于为此参数指定的类。如果需要更多，请在训练过程完成后增加此值并聚合类。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Number Of Classes / Clusters")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public long? _max_classes { get; set; }


        /// <summary>
        /// <para>Output Classifier Definition File</para>
        /// <para>The output JSON format file that will contain attribute information, statistics, hyperplane vectors, and other information for the classifier. An .ecd file will be created.</para>
        /// <para>输出 JSON 格式文件，其中包含分类器的属性信息、统计信息、超平面向量和其他信息。将创建一个 .ecd 文件。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classifier Definition File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_classifier_definition { get; set; }


        /// <summary>
        /// <para>Additional Input Raster</para>
        /// <para>Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.</para>
        /// <para>将合并辅助栅格数据集（例如多光谱影像或 DEM）以生成属性和其他分类所需信息。此参数是可选的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Additional Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_additional_raster { get; set; } = null;


        /// <summary>
        /// <para>Maximum Number Of Iterations</para>
        /// <para><xdoc>
        ///   <para>The maximum number of iterations the clustering process will run.</para>
        ///   <para>The recommended range is between 10 and 20 iterations. Increasing this value will linearly increase the processing time.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>聚类分析进程将运行的最大迭代次数。</para>
        ///   <para>建议的范围介于 10 到 20 次迭代之间。增加此值将线性增加处理时间。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number Of Iterations")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_iterations { get; set; } = 20;


        /// <summary>
        /// <para>Minimum Number of Samples Per Cluster</para>
        /// <para><xdoc>
        ///   <para>The minimum number of pixels or segments in a valid cluster or class.</para>
        ///   <para>The default value of 20 is effective in creating statistically significant classes. You can increase this number for more robust classes; however, it may limit the overall number of classes that are created.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>有效聚类或类中的最小像素数或段数。</para>
        ///   <para>默认值 20 在创建具有统计显著性的类时非常有效。您可以增加此数字以获得更可靠的类;但是，它可能会限制创建的类的总数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Minimum Number of Samples Per Cluster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _min_samples_per_cluster { get; set; } = 20;


        /// <summary>
        /// <para>Skip Factor</para>
        /// <para>Number of pixels to skip for a pixel image input. If a segmented image is an input, specify the number of segments to skip.</para>
        /// <para>像素图像输入要跳过的像素数。如果分段图像是输入，请指定要跳过的分段数。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Skip Factor")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _skip_factor { get; set; } = 10;


        /// <summary>
        /// <para>Segment Attributes Used</para>
        /// <para><xdoc>
        ///   <para>Specifies the attributes that will be included in the attribute table associated with the output raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Converged color—The RGB color values will be derived from the input raster on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Mean digital number—The average digital number (DN) will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Count of pixels—The number of pixels composing the segment, on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Compactness—The degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.</bullet_item><para/>
        ///     <bullet_item>Rectangularity—The degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>This parameter is only active if the Segmented key property is set to true on the input raster. If the only input to the tool is a segmented image, the default attributes are Average chromaticity color, Count of pixels, Compactness, and Rectangularity. If an Additional Input Raster value is included as an input with a segmented image, Mean digital number and Standard deviation are also available attributes.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将包含在与输出栅格关联的属性表中的属性。</para>
        ///   <bulletList>
        ///     <bullet_item>收敛颜色 - RGB 颜色值将基于每个区段从输入栅格派生。</bullet_item><para/>
        ///     <bullet_item>平均数字数字 - 平均数字数字 （DN） 将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>标准差—标准差将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>像素计数 - 组成区段的像素数（按每个区段计算）。</bullet_item><para/>
        ///     <bullet_item>紧凑度 - 线段的紧凑度或圆形程度（基于每个线段）。值范围从 0 到 1，其中 1 是一个圆。</bullet_item><para/>
        ///     <bullet_item>矩形 - 线段的矩形程度（按线段计算）。值的范围为 0 到 1，其中 1 是矩形。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>仅当输入栅格上的分割键属性设置为 true 时，此参数才处于活动状态。如果工具的唯一输入是分割图像，则默认属性为平均色度颜色、像素计数、紧凑度和矩形度。如果附加输入栅格值作为分割影像的输入包含在内，则平均数字数和标准差也是可用属性。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Segment Attributes Used")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _used_attributes { get; set; } = null;


        /// <summary>
        /// <para>Maximum Number Of Cluster Merges per Iteration</para>
        /// <para>The maximum number of cluster merges per iteration. Increasing the number of merges will reduce the number of classes that are created. A lower value will result in more classes.</para>
        /// <para>每次迭代的最大集群合并数。增加合并次数将减少创建的类数。值越低，类就越多。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Number Of Cluster Merges per Iteration")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_merge_per_iter { get; set; } = 5;


        /// <summary>
        /// <para>Maximum Merge Distance</para>
        /// <para>The maximum distance between cluster centers in feature space. Increasing the distance will allow more clusters to merge, resulting in fewer classes. A lower value will result in more classes. Values from 0 to 5 typically return the best results.</para>
        /// <para>要素空间中聚类中心之间的最大距离。增加距离将允许更多的集群合并，从而减少类。值越低，类就越多。从 0 到 5 的值通常返回最佳结果。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Maximum Merge Distance")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public double _max_merge_distance { get; set; } = 0.5;


        public TrainIsoClusterClassifier SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object parallelProcessingFactor = null, object scratchWorkspace = null, object snapRaster = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, parallelProcessingFactor: parallelProcessingFactor, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, workspace: workspace);
            return this;
        }

    }

}